1. Field of the Invention
The present invention relates to a method, system, and program for accessing variables, such as environment variables, from an operating system for use by an application program.
2. Description of the Related Art
Most operating systems, such as the MICROSOFT WINDOWS** operating system, the DOS operating system, the AIX**operating system, etc., provide for environment variables. Environment variables are used to assign a path to a variable, modify the defaults of various commands, and are used in batch files. The PATH environmental variable indicates which directories the operating system will search for a command. The operating system will always first search in the current directory on the current drive and will then search in the paths listed in the PATH environmental variable if the current directory does not include the attempted command. Other standard environment variables include TMP or TEMP which provides a directory for temporary files, “WINDIR” which specifies the WINDOWS** or operating system's directory; COPYCMD which specifies whether the copy and move commands should prompt for confirmation before overwriting, etc. An environmental variable is defined with a command such as SET envirovariable=string, where envirovariable is the environmental variable name and string is a serires of characters to assign to the variable.
Installation programs typically access the environment variables to determine the location of the temporary files to use during installation and the location of the WINDOWS** operating system directory, which includes various configuration files that the installation program modifies to register the program components being installed. Further, the installation program may want to add the directory of the installed program to the PATH environmental variable to allow the installed program to be executed from any directory.
Environment variables are stored in memory allocated by a configuration file, such as “command.com.” WINDOWS** operating system installation programs, through an Application Program Interface (API) call, may access environment variables from their location in memory. However, programs written in certain cross-platform computer languages, such as Java, cannot access the environment variables. This limitation prevents Java implemented programs from making effective use of environment variables, such as the temporary files and the location of the operating system directory and configuration files, e.g., c:/windows. Thus, there is a need in the art to provide programs such as Java access to environment variables.